package com.ita.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ita.dao.BookDao;
import com.ita.dao.impl.BookDaoImpl;
import com.ita.pojo.Book;

public class ShowBookListServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		BookDao bookDao = new BookDaoImpl();
		List<Book> books = bookDao.findAllBook();
		request.setAttribute("booklist", books);
		request.getRequestDispatcher("booklist.jsp").forward(request,
				response);
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
